package data;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

public class Cell {
	
	private boolean buildable;
	private char walkDirection = 'X';
	private Point position = new Point(0,0);
	
	public Cell() {
		
	}
	public Cell(boolean buildable, char walkDirection, Point position) {
		this.buildable = buildable;
		this.walkDirection = walkDirection;
		this.position = position;
	}
	public Cell(boolean buildable, char walkDirection, int x, int y) {
		this.buildable = buildable;
		this.walkDirection = walkDirection;
		this.position = new Point(x,y);
	}
	public void setBuildable(boolean buildable) {this.buildable = buildable;}
	public boolean isBuildable() {return buildable;}
	public void setWalkDirection(char walkDirection) {this.walkDirection = walkDirection;}
	public char getWalkDirection() {return walkDirection;}
	public void setPosition(Point position) {this.position = position;}
	public Point getPosition() {return position;}
	public void drawOn(Graphics g) {
		final int CELLSIZE = 50;
		int x = this.position.x * CELLSIZE;
		int y = this.position.y * CELLSIZE;
		if (this.getWalkDirection() == 'X') {
			g.setColor(Color.GREEN);
			g.fillRect(x , y, x + CELLSIZE, y + CELLSIZE);
			g.setColor(Color.BLACK);
			g.drawRect(x , y, x + CELLSIZE, y + CELLSIZE);
		}
		else {
			g.setColor(Color.YELLOW);
			g.fillRect(x , y, x + CELLSIZE, y + CELLSIZE);
			g.setColor(Color.BLACK);
			g.drawRect(x , y, x + CELLSIZE, y + CELLSIZE);
		}
	}

}
